//
// Created by RainbowSea on 2025/7/1.
//

#ifndef GUMBALLS_YA_XUE_YAXUE_H
#define GUMBALLS_YA_XUE_YAXUE_H


#include <cstdint>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
using namespace std;
class YaXue {
public:
    YaXue(uint64_t origin_blood,uint64_t target_blood);
    void setAttackVec(vector<uint64_t>& attack_vec);
    void setShieldVec(vector<uint64_t>& shield_vec);
    void setBloodReturningVec(vector<uint64_t>& br_vec);
    void run(uint32_t max_step = 100);
protected:
    enum StepType{
        Attack,
        Shield,
        BloodReturning,
    };
    struct Step{
        Step(StepType type, uint32_t vecIndex);

        StepType type;
        uint32_t vec_index;
    };

    struct Status{
        Status();

        explicit Status(uint64_t currentBlood);

        uint64_t getAll() { return current_blood + current_shield;}
        uint64_t getBlood() {return current_blood;}
        vector<Step> history;
        uint64_t current_blood,current_shield;
    };
    void tryDoAttack(Status now_status);
    void tryDoShield(Status now_status);
    void tryDoReturning(YaXue::Status now_status);
private:
    uint64_t _origin_blood,_target_blood;
    vector<uint64_t> _attack_vec,_shield_vec,_br_vec;
    uint64_t _max_attack;
    queue<Status> _que;
    bool _is_run = false;

};


#endif //GUMBALLS_YA_XUE_YAXUE_H
